#include <iostream>

#include "logger.hpp"

using namespace std;

void test() 
{
    int cur_size = 0;
    int cnt = 1;
    while (cur_size ++ < 2) 
    {
        Log::GetLogger("asynclogger")->Info("测试日志-%d", cnt++);
        Log::GetLogger("asynclogger")->Warn("测试日志-%d", cnt++);
        Log::GetLogger("asynclogger")->Debug("测试日志-%d", cnt++);
        Log::GetLogger("asynclogger")->Error("测试日志-%d", cnt++);
        Log::GetLogger("asynclogger")->Fatal("测试日志-%d", cnt++);
    }
}

void start_log()
{
    std::shared_ptr<Log::LoggerBuilder> Glb(new Log::LoggerBuilder());
    Glb->BuildLoggerName("asynclogger");
    Glb->BuildLoggerFlush<Log::StdoutFlushImpl>("./logfile/FileFlush.log");
    // Glb->BuildLoggerFlush<Log::RollFileFlush>("./logfile/RollFile_log", 1024 * 1024);

    Log::LoggerMgr::Instance().AddLogger(Glb->Build());
    test();
}

int main()
{
    start_log();
    return 0;
}